#ifndef KEYLISTENER_HPP
#define KEYLISTENER_HPP

/********************************************************************
	created:	2011/01/17
	filename: 	E:\C++\Red\src\Graphics\MouseListener.hpp
	author:		Red
	
	purpose:	Key Events listener
*********************************************************************/

#include "Listener.hpp"

namespace red {
	/// SFML Keyboard callback specialised Listener
	class REDAPI KeyListener : public Listener{
	public:
		KeyListener() {
			mType = LT_Key;	
		}

		/// Callable function which send the received event in the right callback
		/// @param pEvent : Received Event
		virtual void OnEvent(const sf::Event &pEvent){
			switch(pEvent.Type){
			case sf::Event::TextEntered:
				OnTextEntered(pEvent.Text);
				break;
			case sf::Event::KeyPressed:
				OnKeyPressed(pEvent.Key);
				break;
			case sf::Event::KeyReleased:
				OnKeyReleased(pEvent.Key);
				break;
			default:
				break;
			}
		}

	protected:
		// Overloadable functions for an inherited class
			/// Key Event : sf::TextEntered
			virtual void OnTextEntered(const sf::Event::TextEvent &pEvent) {}

			/// Key Event : sf::KeyPressed
			virtual void OnKeyPressed(const sf::Event::KeyEvent &pEvent) {}

			/// Key Event : sf::KeyReleased
			virtual void OnKeyReleased(const sf::Event::KeyEvent &pEvent) {}
	};

	typedef std::vector<KeyListener*> KeyListenerList;
}
#endif // KEYLISTENER_HPP
